﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class admin_ChiTietFooter : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            lblViTri.Text = "Footer";

            ddlLang.DataSource = LoaiDataHelper.LoadNgonNgu();
            ddlLang.DataTextField = "Value";
            ddlLang.DataValueField = "Key";
            ddlLang.DataBind();

            TrangTinhDataSet TrangTinhds = new TrangTinhDataSet();
            TrangTinhHelper TrangTinhhelper = new TrangTinhHelper();
            TrangTinhds = TrangTinhhelper.LoadTrangTinhViTri("Footer", 2);


            if (!TrangTinhds.TrangTinh[0].IsNoiDungNull()) txtTongQuan.Value = TrangTinhds.TrangTinh[0].NoiDung;

            Session[this.Request.Url.AbsolutePath.ToString() + "_" + "Data"] = TrangTinhds;
        }
    }
    protected void btnOK_OnClick(object sender, EventArgs e)
    {
        TrangTinhDataSet TrangTinhds = (TrangTinhDataSet)Session[this.Request.Url.AbsolutePath.ToString() + "_" + "Data"];
        TrangTinhDataSet.TrangTinhRow row = TrangTinhds.TrangTinh[0];

        row.NoiDung = txtTongQuan.Value;

        new TrangTinhHelper().SaveTrangTinh(TrangTinhds);
    }

    protected void ddlLang_OnSelectedIndexChanged(object sender, EventArgs e)
    {
        TrangTinhDataSet TrangTinhds = new TrangTinhDataSet();
        TrangTinhHelper TrangTinhhelper = new TrangTinhHelper();
        TrangTinhds = TrangTinhhelper.LoadTrangTinhViTri("Footer", Convert.ToInt32(ddlLang.SelectedValue));
        if (TrangTinhds.TrangTinh.Rows.Count > 0)
        {
            if (!TrangTinhds.TrangTinh[0].IsNoiDungNull()) txtTongQuan.Value = TrangTinhds.TrangTinh[0].NoiDung;
        }
        Session[this.Request.Url.AbsolutePath.ToString() + "_" + "Data"] = TrangTinhds;
    }
}